import java.util.Scanner;

public class Textx {
    public static void main(String[] args) {
        Scanner reader = new Scanner(System.in);
        System.out.println("请输入整数n");
        int n = reader.nextInt();
        System.out.println(Factorial(n));
    }

    public static int Factorial(int n){
        int a = 0;
        for(int i = 1;i <= n;i++){
            int b = 1;
            for(int j = 1;j <=i;j++){
                b = b*j;
                a += b;
            }
        }
        return a;
    }
}
//用户输入整数n，计算1!+(1!+2!)+(1!+2!+3!)+…..+(1!+2!+…n!)
//       用方法实现
//       有参数有返回值